#include <msa.h>
#include "convert.h"
#include "tile2nv12.h"

IHAL_INT32 IHal_Convert_Tile420ToNV12(struct tile420_fmt src_buf, struct nv12_fmt *dst_buf)
{
	if (!dst_buf)
		return -IHAL_RERR;
    _tile420_nv12_msa(src_buf, dst_buf);
	return IHAL_ROK;
}

IHAL_INT32 IHal_Convert_Tile420ToNV12_WithRotate(struct tile420_fmt src_buf, struct nv12_fmt *dst_buf,int rotated)
{
	if (!dst_buf)
		return -IHAL_RERR;
    if(rotated == 0) {
        _tile420_nv12_msa(src_buf, dst_buf);
    } else if(rotated == 90) {
        _tile420_nv12_msa_90(src_buf, dst_buf);
    } else if(rotated == 180) {
        _tile420_nv12_msa_180(src_buf, dst_buf);
    } else if(rotated == 270) {
        _tile420_nv12_msa_270(src_buf, dst_buf);
    } else {
        return -IHAL_RERR;
    }
	return IHAL_ROK;
}
